﻿using Avalonia.Media;

namespace Ursa.Music._163.Utils;

public static class ColorUtils
{
    /// <summary>
    /// 获取 HSV 中所有的基础颜色 (饱和度和明度均为最大值)
    /// </summary>
    /// <returns>所有的 HSV 基础颜色(共 256 * 6 个, 并且随着索引增加, 颜色也会渐变)</returns>
    public static Color[] GetAllHsvColors()
    {
        Color[] result = new Color[256 * 6];

        for (int i = 0; i <= 255; i++)
        {
            result[i] = Color.FromArgb(255, 255, (byte)i, 0);
        }

        for (int i = 0; i <= 255; i++)
        {
            result[256 + i] = Color.FromArgb(255, (byte)(255 - i), 255, 0);
        }

        for (int i = 0; i <= 255; i++)
        {
            result[512 + i] = Color.FromArgb(255, 0, 255, (byte)i);
        }

        for (int i = 0; i <= 255; i++)
        {
            result[768 + i] = Color.FromArgb(255, 0, (byte)(255 - i), 255);
        }

        for (int i = 0; i <= 255; i++)
        {
            result[1024 + i] = Color.FromArgb(255, (byte)i, 0, 255);
        }

        for (int i = 0; i <= 255; i++)
        {
            result[1280 + i] = Color.FromArgb(255, 255, 0, (byte)(255 - i));
        }

        return result;
    }

}